if(isset($_POST['Import']))
{
     $fname = $_FILES['sel_file']['name'];
     
     $chk_ext = explode(".",$fname);
     
     if(strtolower($chk_ext[1]) == "csv")
     {
     
         $filename = $_FILES['sel_file']['tmp_name'];
         $handle = fopen($filename, "r");
    
         while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
         {
            $sql = "INSERT into user(name,email,phone) values('$data[0]','$data[1]','$data[2]')";
            mysql_query($sql) or die(mysql_error());
         }
    
         fclose($handle);
         echo "Successfully Imported";
     }
     else
     {
         echo "Invalid File";
     }    
}

<form action='<?php echo $_SERVER["PHP_SELF"];?>' method='post'>

    Import File : <input type='text' name='sel_file' size='20'>
    <input type='submit' name='Import' value='submit'>

</form>